package com.steak.bootactivemq.service.impl;

import com.google.gson.Gson;
import com.steak.bootactivemq.entity.Opt;
import com.steak.bootactivemq.mapper.OptMapper;
import com.steak.bootactivemq.service.OptService;
import com.steak.bootactivemq.util.ObjectConverter;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jms.annotation.JmsListener;
import org.springframework.jms.core.JmsMessagingTemplate;
import org.springframework.jms.support.converter.MessageConverter;
import org.springframework.stereotype.Service;

import javax.jms.*;
import java.util.List;
import java.util.Map;

@Service
public class OptServiceImpl implements OptService {
    @Autowired
    private OptMapper optMapper;

    @Autowired
    private JmsMessagingTemplate jmsMessagingTemplate;

    //@JmsListener(destination = "${myQueue}")
    public void register(ObjectMessage objectMessage) throws JMSException {
        Opt opt = (Opt) objectMessage.getObject();
        optMapper.register(opt.getOpt_code() , opt.getName() );
    }
}
